<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@page import="com.szrt.javaweb.HttpSessionListener" %>
<%@page import="java.util.Date" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

	<h4>HttpSessionListener 演示从内存保存到硬盘</h4>
	
	<%
		Object obj =session.getAttribute("aabbccdd");
	
		out.print(session.getId()+"<br/>");
	
		if(obj == null){
			//第一次访问 没有将对象从内存中保持到硬盘中
			HttpSessionListener zxx = new HttpSessionListener();
			Date date = new Date();
			out.println(date.toString() +"<br/>");
			zxx.setYmd(date.toString());
			session.setAttribute("aabbccdd", zxx);
			out.print("第一次访问....");
		}else{
			out.print("第二次访问....");
			HttpSessionListener jg = (HttpSessionListener)obj;
			out.print(jg.getYmd());
		}
		
		
			
	%>

</body>
</html>